package com.rtuwrapper;

public interface ModbusConstants {

    int VENDOR_ID = 0x67b;

    //--FUNCTION CODES--//
    byte READ_COIL = 0x01;
    byte READ_REGISTER = 0x03;
    byte READ_FLOAT = 0x33;
    byte READ_INTEGER = 0x34;
    byte WRITE_COIL = 0x05;
    byte WRITE_REGISTER = 0x06;

    int MAX_MESSAGE_LENGTH = 256;
    int MAX_SLAVE_ID = 247;

    int DEFAULT_SLAVE_ID = 1;

    long DEFAULT_WAIT_RESPONSE_TIMEOUT = 20;
    int DEFAULT_TIMEOUT = 3000;
    boolean DEFAULT_RECONNECTING = false;
    int DEFAULT_RETRIES = 3;

    int NO_CRC_WRITE_RESPONSE_SIZE = 6;
    int NO_CRC_READ_RESPONSE_SIZE = 5;
    int NO_CRC_EXCEPTION_RESPONSE_SIZE = 3;

    //--EXCEPTIONS--//
    int EXCEPTION_OFFSET = 128;

    int NO_RESPONSE_EXCEPTION = 0;
    int ILLEGAL_FUNCTION_EXCEPTION = 1;
    int ILLEGAL_DATA_ADDRESS_EXCEPTION = 2;
    int ILLEGAL_DATA_VALUE_EXCEPTION = 3;
    int SLAVE_DEVICE_FAILURE_EXCEPTION = 4;
    int ACKNOWLEDGE_EXCEPTION = 5;
    int SLAVE_DEVICE_BUSY_EXCEPTION = 6;
    int NEGATIVE_ACKNOWLEDGE_EXCEPTION = 7;
    int MEMORY_PARITY_EXCEPTION = 8;
    int GATEWAY_PATH_UNAVAILABLE_EXCEPTION = 9;
    int TARGET_DEVICE_RESPONCE_EXCEPTION = 10;
    int INVALID_RESPONSE_EXCEPTION = 11;
    int UNKNOWN_FUNCTION_CODE_EXCEPTION = 12;

}
